<template>
	<view>
		<input v-model="keyword" :focus="true" @confirm="handleQuery"/>
		<view id="question-item-container">
			<view class="question-item" v-for="item in questionList" v-bind:id="item" @click="handleQuestionItenClick(item)">
				<view>标题: {{item.title}}</view>
				<view>所属模块: {{item.moduleName}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				keyword: null,
				questionList: [],
			}
		},
		methods: {
			handleQuery() {
				this.$api.esList(this.keyword).then(res => {
					this.questionList = res;
				})
			},
			handleQuestionItenClick(item) {
				uni.navigateTo({
					url: '../questionDetail/questionDetail?questionId=' + item.id,
				})
			}
		}
	}
</script>

<style scoped>
	input {
		text-align: center;
		width:100%;
		height: 30px;
		border: 2px solid #9BDBDB;
		border-radius: 10px;
	}
	.question-item {
			pading-top: 10px;
			padding-bottom: 5px;
			padding-left: 3rem;
			margin-top: 5px;
			width: 100%;
	/* 		border-bottom: 1px solid #09BB07;
			border-top: 1px solid #09BB07; */
			background-color: #9BDBDB;
			border-top-left-radius: 20px;
			border-bottom-left-radius: 20px;
	}
	#question-item-container {
		width:100%;
	}
	
</style>
